﻿

using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Web.Profile;


    public partial class admin_product_goods_add08 : System.Web.UI.Page
    {
        // Fields
        public string param_1 = "0";
        public string param_2 = "0";
        public string param_3 = "0";
        public string param_4 = "0";
        public string param_5 = "0";
        public string param_6 = "0";
        public string param_7 = "0";
        public string params_01 = "";
        public string params_02 = "";
        public string params_03 = "";
        public string params_04 = "";
        public string params_05 = "";
        public string params_06 = "";
        public string params_07 = "";
        public string params_08 = "";
        public string params_09 = "";
        public string params_1 = "0";
        public string params_2 = "0";
        public string params_3 = "0";
        public string params_4 = "0";
        public string params_5 = "0";
        public string params_6 = "0";
        public string params_7 = "0";
        public string params_8 = "0";
        public string params_9 = "0";
        public string shuxinstr1 = "";
        public string shuxinstr2 = "";
        public string shuxinstr3 = "";
        public string shuxinstr4 = "";
        public string shuxinstr5 = "";
        public string shuxinstr6 = "";
        public string shuxinstr7 = "";

        // Methods
        private void Bind()
        {
            DataTable table = SQLAccess.GreatDs("select * from DB_shuxintype where languages=" + info.languages("") + "").Tables[0];
            if (table.Rows.Count > 0)
            {
                int num = 1;
                foreach (DataRow row in table.Rows)
                {
                    DataTable table2 = SQLAccess.GreatDs("select * from DB_Shuxinvalue where shuxinid=" + row["shuxinid"].ToString() + "").Tables[0];
                    if (table2.Rows.Count > 0)
                    {
                        foreach (DataRow row2 in table2.Rows)
                        {
                            switch (num)
                            {
                                case 1:
                                    if (this.param_1.ToString() == row2["shuxinvalueid"].ToString())
                                    {
                                        string str3 = this.shuxinstr1;
                                        this.shuxinstr1 = str3 + "<input name='parameter_" + row["shuxinid"].ToString() + "' type='radio' value='" + row2["shuxinvalueid"].ToString() + "' checked />" + row2["shuxinname"].ToString() + " &nbsp;";
                                    }
                                    else
                                    {
                                        string str4 = this.shuxinstr1;
                                        this.shuxinstr1 = str4 + "<input name='parameter_" + row["shuxinid"].ToString() + "' type='radio' value='" + row2["shuxinvalueid"].ToString() + "' />" + row2["shuxinname"].ToString() + " &nbsp;";
                                    }
                                    break;

                                case 2:
                                    if (this.param_2.ToString() == row2["shuxinvalueid"].ToString())
                                    {
                                        string str5 = this.shuxinstr2;
                                        this.shuxinstr2 = str5 + "<input name='parameter_" + row["shuxinid"].ToString() + "' type='radio' value='" + row2["shuxinvalueid"].ToString() + "' checked />" + row2["shuxinname"].ToString() + " &nbsp;";
                                    }
                                    else
                                    {
                                        string str6 = this.shuxinstr2;
                                        this.shuxinstr2 = str6 + "<input name='parameter_" + row["shuxinid"].ToString() + "' type='radio' value='" + row2["shuxinvalueid"].ToString() + "' />" + row2["shuxinname"].ToString() + " &nbsp;";
                                    }
                                    break;

                                case 3:
                                    if (this.param_3.ToString() == row2["shuxinvalueid"].ToString())
                                    {
                                        string str7 = this.shuxinstr3;
                                        this.shuxinstr3 = str7 + "<input name='parameter_" + row["shuxinid"].ToString() + "' type='radio' value='" + row2["shuxinvalueid"].ToString() + "' checked />" + row2["shuxinname"].ToString() + " &nbsp;";
                                    }
                                    else
                                    {
                                        string str8 = this.shuxinstr3;
                                        this.shuxinstr3 = str8 + "<input name='parameter_" + row["shuxinid"].ToString() + "' type='radio' value='" + row2["shuxinvalueid"].ToString() + "' />" + row2["shuxinname"].ToString() + " &nbsp;";
                                    }
                                    break;

                                case 4:
                                    if (this.param_4.ToString() == row2["shuxinvalueid"].ToString())
                                    {
                                        string str9 = this.shuxinstr4;
                                        this.shuxinstr4 = str9 + "<input name='parameter_" + row["shuxinid"].ToString() + "' type='radio' value='" + row2["shuxinvalueid"].ToString() + "' checked />" + row2["shuxinname"].ToString() + " &nbsp;";
                                    }
                                    else
                                    {
                                        string str10 = this.shuxinstr4;
                                        this.shuxinstr4 = str10 + "<input name='parameter_" + row["shuxinid"].ToString() + "' type='radio' value='" + row2["shuxinvalueid"].ToString() + "' />" + row2["shuxinname"].ToString() + " &nbsp;";
                                    }
                                    break;

                                case 5:
                                    if (this.param_5.ToString() == row2["shuxinvalueid"].ToString())
                                    {
                                        string str11 = this.shuxinstr5;
                                        this.shuxinstr5 = str11 + "<input name='parameter_" + row["shuxinid"].ToString() + "' type='radio' value='" + row2["shuxinvalueid"].ToString() + "' checked />" + row2["shuxinname"].ToString() + " &nbsp;";
                                    }
                                    else
                                    {
                                        string str12 = this.shuxinstr5;
                                        this.shuxinstr5 = str12 + "<input name='parameter_" + row["shuxinid"].ToString() + "' type='radio' value='" + row2["shuxinvalueid"].ToString() + "' />" + row2["shuxinname"].ToString() + " &nbsp;";
                                    }
                                    break;

                                case 6:
                                    if (this.param_6.ToString() == row2["shuxinvalueid"].ToString())
                                    {
                                        string str13 = this.shuxinstr6;
                                        this.shuxinstr6 = str13 + "<input name='parameter_" + row["shuxinid"].ToString() + "' type='radio' value='" + row2["shuxinvalueid"].ToString() + "' checked />" + row2["shuxinname"].ToString() + " &nbsp;";
                                    }
                                    else
                                    {
                                        string str14 = this.shuxinstr6;
                                        this.shuxinstr6 = str14 + "<input name='parameter_" + row["shuxinid"].ToString() + "' type='radio' value='" + row2["shuxinvalueid"].ToString() + "' />" + row2["shuxinname"].ToString() + " &nbsp;";
                                    }
                                    break;

                                case 7:
                                    {
                                        if (this.param_7.ToString() == row2["shuxinvalueid"].ToString())
                                        {
                                            string str15 = this.shuxinstr7;
                                            this.shuxinstr7 = str15 + "<input name='parameter_" + row["shuxinid"].ToString() + "' type='radio' value='" + row2["shuxinvalueid"].ToString() + "' checked />" + row2["shuxinname"].ToString() + " &nbsp;";
                                            continue;
                                        }
                                        string str16 = this.shuxinstr7;
                                        this.shuxinstr7 = str16 + "<input name='parameter_" + row["shuxinid"].ToString() + "' type='radio' value='" + row2["shuxinvalueid"].ToString() + "' />" + row2["shuxinname"].ToString() + " &nbsp;";
                                        break;
                                    }
                            }
                        }
                        num++;
                    }
                }
            }
        }

        protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
        {
            if (base.Request.QueryString["pid"] != null)
            {
                SQLAccess.DoSql("update DB_Shoppro set parameter_1=" + base.Request.Form["parameter_1"] + ",parameter_2=" + base.Request.Form["parameter_2"] + ",parameter_3=" + base.Request.Form["parameter_3"] + ",parameter_4=" + base.Request.Form["parameter_4"] + ",parameter_5=" + base.Request.Form["parameter_5"] + ",parameter_6=" + base.Request.Form["parameter_6"] + ",parameter_7=" + base.Request.Form["parameter_7"] + ",para_1=" + base.Request.Form["para_1"] + ",para_2=" + base.Request.Form["para_2"] + ",para_3=" + base.Request.Form["para_3"] + ",para_4=" + base.Request.Form["para_4"] + ",para_5=" + base.Request.Form["para_5"] + ",para_6=" + base.Request.Form["para_6"] + ",para_7=" + base.Request.Form["para_7"] + ",para_8=" + base.Request.Form["para_8"] + ",para_9=" + base.Request.Form["para_9"] + ",para_01='" + base.Request.Form["para_01"] + "',para_02='" + base.Request.Form["para_02"] + "',para_03='" + base.Request.Form["para_03"] + "',para_04='" + base.Request.Form["para_04"] + "',para_05='" + base.Request.Form["para_05"] + "',para_06='" + base.Request.Form["para_06"] + "',para_07='" + base.Request.Form["para_07"] + "',para_08='" + base.Request.Form["para_08"] + "',para_09='" + base.Request.Form["para_09"] + "' where proid=" + base.Request.QueryString["pid"] + "");
                base.Response.Write("<script language='javascript'>alert('更新成功');window.location.href='goods_add03.aspx?pid=" + base.Request.QueryString["pid"] + "';</script>");
                base.Response.End();
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.Session["Adminlogin"] == null)
            {
                base.Response.Write("<script language=javascript>window.top.location.href='../login.aspx';</script>");
                base.Response.End();
            }
            this.ImageButton1.Attributes["onclick"] = "return clicka();";
            if (!base.IsPostBack)
            {
                if (base.Request.QueryString["pid"] != null)
                {
                    this.upbind();
                }
                this.Bind();
            }
        }

        private void upbind()
        {
            string sql = "select top 1 * from DB_Shoppro where proid=" + base.Request.QueryString["pid"];
            DataTable table = new DataTable();
            table = SQLAccess.GreatDs(sql).Tables[0];
            if (table.Rows.Count > 0)
            {
                this.param_1 = table.Rows[0]["parameter_1"].ToString();
                this.param_2 = table.Rows[0]["parameter_2"].ToString();
                this.param_3 = table.Rows[0]["parameter_3"].ToString();
                this.param_4 = table.Rows[0]["parameter_4"].ToString();
                this.param_5 = table.Rows[0]["parameter_5"].ToString();
                this.param_6 = table.Rows[0]["parameter_6"].ToString();
                this.param_7 = table.Rows[0]["parameter_7"].ToString();
                this.params_1 = table.Rows[0]["para_1"].ToString();
                this.params_2 = table.Rows[0]["para_2"].ToString();
                this.params_3 = table.Rows[0]["para_3"].ToString();
                this.params_4 = table.Rows[0]["para_4"].ToString();
                this.params_5 = table.Rows[0]["para_5"].ToString();
                this.params_6 = table.Rows[0]["para_6"].ToString();
                this.params_7 = table.Rows[0]["para_7"].ToString();
                this.params_8 = table.Rows[0]["para_8"].ToString();
                this.params_9 = table.Rows[0]["para_9"].ToString();
                this.params_01 = table.Rows[0]["para_01"].ToString();
                this.params_02 = table.Rows[0]["para_02"].ToString();
                this.params_03 = table.Rows[0]["para_03"].ToString();
                this.params_04 = table.Rows[0]["para_04"].ToString();
                this.params_05 = table.Rows[0]["para_05"].ToString();
                this.params_06 = table.Rows[0]["para_06"].ToString();
                this.params_07 = table.Rows[0]["para_07"].ToString();
                this.params_08 = table.Rows[0]["para_08"].ToString();
                this.params_09 = table.Rows[0]["para_09"].ToString();
            }
        }

   

    }
